import { GCellRenderer } from "../../../../../com/mui/controls/GCellRenderer";
import { IToolTipItem } from "../../../../../com/mui/manager/IToolTipItem";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
import { ObjCreate } from "../../common/ObjCreate";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { SRobCityTwoJoinTeam } from "../../../../../Message/Public/SRobCityTwoJoinTeam";
import { RobCityUtill } from "../RobCityUtill";
import { EntityUtil } from "../../../scene/layer/utils/EntityUtil";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { Language } from "../../../../../extend/language/Language";
import { RemainTimeTool } from "../../award/RemainTimeTool";
import { ScaleBitmap } from "../../../../../com/mui/display/ScaleBitmap";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
//class RobCityStepTwoTeamRenderer
    
    export  class RobCityStepTwoTeamRenderer extends GCellRenderer implements IToolTipItem
    {
        constructor()
        {
            super();
            this._bg = GlobalClass.getScaleBitmap(ImagesConst.ButtonGreen_upSkin, new Object /* flash.geom.Rectangle */(19, 9, 23, 1));
            this._bg.width = 170;
            this._bg.height = 22;
            this._bg.x = 10;
            this.addChild(this._bg);
            this._nameLabel = ObjCreate.createGTextField("", 0, 1, 190, 20, this, GlobalStyle.getTextFormatCenter(GlobalStyle.textFormat1));
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            var loc2=false;
            var loc3=null;
            super.data = arg1;
            var loc1=arg1 as SRobCityTwoJoinTeam;
            if (loc1) 
            {
                loc2 = RobCityUtill.checkHasUnion(loc1.guildUnion);
                this._nameLabel.htmlText = "[" + EntityUtil.getProxyName(loc1.sEntityId) + "]" + loc1.guildName;
                if (RobCityUtill.isMyGuildByEntityId(loc1.sEntityId)) 
                {
                    this._bg.bitmapData = GlobalClass.getBitmapData(ImagesConst.ButtonGreen_upSkin);
                    this._bg.setSize(170, 24);
                }
                else 
                {
                    this._bg.bitmapData = GlobalClass.getBitmapData(ImagesConst.ShortcutBtn_upSkin);
                    this._bg.setSize(170, 24);
                }
                loc3 = (loc3 = "") + (HTMLUtil.addColor(Language.getStringByParam(60931, loc1.rank, loc1.guildName), GlobalStyle.color4) + "\n");
                if (loc2) 
                {
                    if (loc1.guildUnion.secondGuildId > 0) 
                    {
                        loc3 = loc3 + (HTMLUtil.addColor(Language.getStringByParam(60988, loc1.guildUnion.secondGuildName), GlobalStyle.color4) + "\n");
                    }
                    if (loc1.guildUnion.thirdGuildId > 0) 
                    {
                        loc3 = loc3 + (HTMLUtil.addColor(Language.getStringByParam(60988, loc1.guildUnion.thirdGuildName), GlobalStyle.color4) + "\n");
                    }
                }
                loc3 = (loc3 = loc3 + (HTMLUtil.addColor(Language.getStringByParam(60932, EntityUtil.getProxyName(loc1.sEntityId)), GlobalStyle.color1) + "\n")) + HTMLUtil.addColor(Language.getStringByParam(60933, RemainTimeTool.getRemainTimeBySeconds(loc1.score / 1000, false, true)), GlobalStyle.color9);
                this.toolTipData = loc3;
            }
            return;
        }

        /* internal */ /* var */_bg: ScaleBitmap;

        /* internal */ /* var */_nameLabel: GTextFiled;
    }
